#conversation {
    display: flex;
    position: relative;
    flex-direction: column;
    background-image: url('../img/wallpaper_light.png?');
    height: 100%;

    .detail-header {

        .header-avatar {
            cursor: pointer;
        }

        .header-details {
            flex-grow: 1;
            cursor: pointer;
            overflow: hidden;

            > *:first-child {
                font-weight: bold;
            }
        }

        h3 {
            margin: 0 0 4px;
            padding: 0;
            font-size: 120%;
        }

        .conversation-header-details-detail,
        .conversation-header-details-name {
            display: inherit;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.3;
            white-space: nowrap;
        }
    }

    #conversation-is-private {
        display: flex;
        flex-grow: 1;
        align-items: center;
        justify-content: center;
    }

    #conversation-chat {
        @include scrollbar;
        flex-grow: 1;
        overflow: auto;
        overflow-y: scroll;
    }

    #conversation-quote {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        background-color: #ffffff;
        padding: 8px;

        .message-quote {
            @include word-wrap;
            max-width: 85%;
            max-height: 9.4em;
            overflow: hidden;
            line-height: 1.3em;
        }
    }

    #scrolljump {
        $scrolljump-height: 36px;
        position: relative;
        right: 16px;
        bottom: 8px + $scrolljump-height;
        align-self: flex-end;
        z-index: 15;
        outline: none;
        height: 0;

        svg {
            cursor: pointer;
            width: $scrolljump-height;
            height: $scrolljump-height;
        }
    }

    #conversation-footer {
        background-color: $dark-background-color;

        .chat-input {
            margin: 0;
            padding: 0;
            width: 100%;
        }

        #mention-selector {
            padding: 0;

            ul {
                margin: 0;
                padding: 0;
                list-style-type: none;

                > li {
                    cursor: pointer;

                    &:not(:hover) {
                        &:not(.selected) {
                            background-color: #ffffff;
                        }
                    }
                }
            }

            .contact-badge {
                .avatar-box {
                    margin: $main-padding;
                    padding: 0;

                    .avatar {
                        width: 28px;
                        height: 28px;

                        img {
                            width: inherit;
                            height: inherit;
                        }

                        > .work-indicator,
                        > .home-indicator {
                            top: 15px;
                            width: 14px;
                            height: 14px;
                        }
                    }
                }

                .contact-badge-identity {
                    margin-right: $main-padding;
                }
            }
        }
    }
}

// Quoting
.message-quote-content {
    border-left: 5px solid #0000ff;
    padding-left: 5px;
    font-size: .9em;

    .message-name {
        display: block;
        margin-bottom: 8px;
        font-size: .9em;
        font-weight: bold;
    }

    .message-quote {
        @include word-wrap;
    }
}

#conversation-chat .chat {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    min-height: 100%;

    li {
        display: inline-block;
        margin: 0 0 $main-padding;
        padding: 0;

        &.load-more {
            margin-top: $main-padding;
            text-align: center;

            .loading {
                @include message-bubble-shadow;
                display: inline-block;
                border-radius: 50%;
                background-color: #ffffff;
                padding: 6px;
                width: 30px;
                height: 30px;
            }
        }

        &.typing-indicator {
            .message-body {
                min-width: 15px;
            }
        }
    }

    .message {
        display: flex;
        flex-direction: row;
        align-items: flex-start;

        md-menu {
            &:not(.md-open) {
                position: relative;
                visibility: hidden;
            }
        }

        &:hover {
            md-menu {
                visibility: visible;
            }
        }

        .message-quote-content {
            margin-bottom: 8px;
        }

        .loading-element {
            margin: 0;

            > :first-child {
                width: 50px;
                height: 50px;
            }
        }

        // arrow
        .bubble-triangle {
            position: relative;
            width: $bubble-triangle-size;
            height: $bubble-triangle-size;

            &::after {
                @include message-bubble-triangle;
                z-index: 3;
            }

            &::before {
                @include message-bubble-triangle;
                @include message-bubble-shadow;
                z-index: 1;
            }
        }

    }

    .message-body {
        @include message-bubble-shadow;
        display: flex;
        flex-direction: column;
        z-index: 2;
        border-radius: 5px;
        padding: 8px;
        min-width: 64px;
        max-width: 85%;

        &:not(.text-message-body) {
            .thumbnail-loader {
                width: 100%;
                filter: blur(10px);
            }

            .thumbnail {
                text-align: center;
            }

            .message-text {
                display: inline-block;
                margin-top: 8px;
            }
        }

        .message-name {
            margin-bottom: 8px;
            font-size: .9em;
            font-weight: bold;

            // Emoji styling
            > span {
                &:not(.ng-binding) {
                    transform: scale(.6);
                }
            }
        }

        .message-text {
            @include word-wrap;
            line-height: 1.3em;

            a {
                cursor: pointer;
            }

            span {
                white-space: pre-wrap;
            }
        }

        .message-media {
            location {
                display: flex;
                flex-direction: column;
                align-items: center;
                padding: 4px 0;

                .location-message {
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    justify-content: flex-start;
                    cursor: pointer;

                    .location-details {
                        margin-left: 8px;

                        .description {
                            margin-bottom: 6px;
                        }

                        .details {
                            line-height: 1.2em;
                            font-size: .9em;
                        }
                    }
                }
            }

            audio {
                &:focus {
                    outline: none;
                }
            }
        }

        .message-info {
            display: flex;
            flex-direction: row;
            align-items: end;
            margin-top: 4px;
            color: #808080;
            font-size: .8em;
            gap: 4px;

            .message-edited-hint {
                font-style: italic;
                margin-right: 0.5em;
            }

            .message-state {
                margin-left: 5px;

                i {
                    position: relative;
                    top: 2px;
                }

                i.timeout {
                    color: $status-error;
                }
            }

            .message-group-reactions {
                .reaction-ack {
                    color: $theme-green;
                }

                .reaction-dec {
                    color: $status-warning;
                }

                .reaction-margin {
                    margin-right: 5px;
                }
            }

            .message-emoji-reactions {
                display: flex;
                flex-direction: row;
                align-items: center;
                justify-content: start;
                gap: 4px;
                flex-wrap: wrap;

                .bucket {
                    cursor: default;

                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    justify-content: center;

                    padding: 3px 9px;
                    background-color: #e0e0e0;
                    border: #ffffff solid 1px;
                    border-radius: 15px;

                    &.active {
                        background-color: #bdbdbd;
                    }

                    .emoji,
                    .count {
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        justify-content: center;
                    }

                    .emoji {
                        width: 18px;
                        height: 18px;
                        font-size: 14px;
                        line-height: 18px;

                        padding-bottom: 1px;

                        img.em {
                            margin: 0;
                        }
                    }

                    .count {
                        font-weight: bold;
                        padding-left: 1px;
                    }

                    &:has(> .count) {
                        padding: 3px 6px 3px 4px;
                    }
                }
            }

            .message-date {
                text-align: end;
            }

            md-icon {
                width: 1em;
                min-width: 1em;
                height: 1em;
                min-height: 1em;
                vertical-align: top;
                font-size: 1em;
            }
        }
    }

    .message-in {
        .message-body {
            position: relative;
            background-color: $message-bubble-color-in;
        }

        // arrow
        .bubble-triangle {
            margin-left: $main-padding;

            &::after {
                background-color: $message-bubble-color-in;
            }

            &::before {
                background-color: $message-bubble-color-in;
            }
        }

        .message-info {
            justify-content: flex-start;
        }
    }

    .message-out {
        flex-direction: row-reverse;

        .message-body {
            position: relative;
            background-color: $message-bubble-color-out;
        }

        // arrow
        .bubble-triangle {
            left: 0 - $bubble-triangle-size;

            &::after {
                background-color: $message-bubble-color-out;
            }

            &::before {
                background-color: $message-bubble-color-out;
            }
        }

        .message-info {
            justify-content: flex-end;

        }
    }

    .message-avatar {
        flex-shrink: 0;
        margin-left: 8px;
        cursor: pointer;
    }

    .message-status {
        justify-content: center;

        .message-body {
            background-color: #fcf8e3;

            .message-text {
                margin-top: 0;
            }
        }
    }

    .unread-separator {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        margin: 16px 8px;
        width: 100%;

        .line {
            flex-grow: 1;
            border-bottom: 1px solid #bbbbbb;
            text-align: center;
            line-height: 0;
        }

        .text {
            margin: 0;
            padding: 0 10px;
            text-shadow: 0 0 4px #bbbbbb;
            font-size: .9em;
            font-weight: 300;
        }
    }

    .message-info {
        .message-meta-item {
            padding-right: 5px;

            &::after {
                padding-left: 5px;
                content: '|';
            }
        }
    }

}

md-menu-item {
    a span {
        color: $material-grey-dark;
    }
}
